<template>
  <view id="content">
    <view style="margin-left: 56rpx;margin-top: 25rpx;">问题和意见<span style="color: red;font-size: 30rpx;">*</span>
    </view>
    <view style="display: flex;justify-content: center; margin-top: 10rpx;">
      <view
          style="width: 700rpx;height: 400rpx;background-color: white;font-size: 28rpx;border-radius: 36rpx;margin-top:10rpx;">
        <textarea v-model="fkInfo" maxlength=1000 style="padding-left: 25rpx;padding-top:15rpx;width: 660rpx;;"
                  placeholder="请填写您的反馈建议，感谢您的支持 ~" placeholder-style="color:#d9d9d9"></textarea>
      </view>
    </view>
    <!-- <span style="color: green;">{{tips}}</span> -->
    <view style="display: flex;justify-content: center;margin-top: 100rpx;">
      <button @click="submit" class="submit">提交</button>
    </view>
  </view>
</template>

<script>
import request from '../../utils/request.js'
import {
  checkLogin
} from '../../utils/common.js'

export default {
  data() {
    return {
      tips: '',
      fkInfo: ''
    }
  },
  onShow() {
    var _this = this;
  },
  onShareAppMessage(res) {
    let pages = getCurrentPages(); //获取当前页面栈的信息
    let currentPage = pages[pages.length - 1]; //获取到当前页面栈中最后一个页面的索引
      if (res.from === 'button') {// 来自页面内分享按钮
        console.log(res.target)
      }
      return {
        title: '逐金污师丨成人情趣甄选好物',
        path: currentPage.route + `?id=${this.id}&share=${this.share}` //后面是路径上要传递的参数
      }
    },
	onShareTimeline(res) {
	  let pages = getCurrentPages(); //获取当前页面栈的信息
	  let currentPage = pages[pages.length - 1]; //获取到当前页面栈中最后一个页面的索引
	    if (res.from === 'button') {// 来自页面内分享按钮
	      console.log(res.target)
	    }
	    return {
	      title: '逐金污师丨成人情趣甄选好物',
	      path: currentPage.route + `?id=${this.id}&share=${this.share}` //后面是路径上要传递的参数
	    }
	  },
  methods: {
    submit() {
      var _this = this;
      if ('' == _this.fkInfo) {
        uni.showToast({
          title: '意见不能为空',
          icon: 'error',
          duration: 1000
        });
        return;
      }
      ;
      request({
        url: '/app/v1/fankui/add',
        method: "POST",
        data: {
          "info": _this.fkInfo
        },
      }).then(res => {
        if (200 == res.code) {
          uni.showToast({
            title: '提交成功',
            icon: 'success',
            duration: 1000
          });
          setTimeout(function () {
            uni.switchTab({
              url: '/pages/me/me'
            })
          }, 2000)
        } else {
          _this.tips = '提交失败'
        }
      })
    },

  }
}
</script>

<style>
#content {
  background-color: #f5f5f5;
  height: 100%;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
}

.submit {
  width: 640rpx;
  height: 92rpx;
  border-radius: 46rpx;
  font-size: 36rpx;
  background-image: linear-gradient(to right, #fdd706, #fdb932);
}
</style>
